//
//  TODetailViewController.m
//  X-Tribe
//
//  Created by Miss.Ou on 16/4/2.
//  Copyright © 2016年 Miss.Ou. All rights reserved.
//

#import "TODetailViewController.h"
#import "TODetailHeadView.h"
#import "TOActivityDetail.h"
#import "TOToolBar.h"
@interface TODetailViewController ()<UIScrollViewDelegate,UIToolbarDelegate>

@property(nonatomic,strong)TODetailHeadView *headView;//活动详情的基本信息
@property(nonatomic,strong)TOActivityDetail *activityV;//活动详情
@property(nonatomic,strong)UIScrollView *bgScrollView;
@property(nonatomic,weak)TOToolBar *toolBar ;


@end

@implementation TODetailViewController

- (void)viewDidLoad {
    [super viewDidLoad];
    // Do any additional setup after loading the view.
    self.title = @"活动详情";
    [self createbgScrollView];
    [self createHeadView];
    [self createDetailV];
    [self setupToolbar];
}

-(void)createbgScrollView{

    self.bgScrollView = [[UIScrollView alloc] initWithFrame:self.view.bounds];
    self.bgScrollView.backgroundColor = [UIColor greenColor];
    self.bgScrollView.contentSize = CGSizeMake(SCREEN_WIDTH, SCREEN_HEIGHT*3);
    self.bgScrollView.bounces = NO;
    self.bgScrollView.delegate = self;
    [self.view addSubview:_bgScrollView];
}
-(void)createHeadView{
    self.headView = [[TODetailHeadView alloc] initWithFrame:CGRectMake(0, 0, SCREEN_WIDTH, 200)];
    [self.bgScrollView addSubview:_headView];
    
}
-(void)createDetailV{
    self.activityV = [[TOActivityDetail alloc] initWithFrame:CGRectMake(0, 200, SCREEN_WIDTH, 500)];
    [self.bgScrollView addSubview:_activityV];

}

//添加工具条
-(void)setupToolbar
{
    //1.创建
    TOToolBar *toolbar = [[TOToolBar alloc]init];
    toolbar.width = SCREEN_WIDTH;
    toolbar.height = 44;
    toolbar.delegate = self;
    toolbar.x = 0;
    //显示Y
    toolbar.y = self.view.height - toolbar.height - 64;
    
    toolbar.backgroundColor = [UIColor redColor];
    self.toolBar = toolbar;
    
    
    [self.view addSubview:self.toolBar];
    
}


- (void)didReceiveMemoryWarning {
    [super didReceiveMemoryWarning];
    // Dispose of any resources that can be recreated.
}

/*
#pragma mark - Navigation

// In a storyboard-based application, you will often want to do a little preparation before navigation
- (void)prepareForSegue:(UIStoryboardSegue *)segue sender:(id)sender {
    // Get the new view controller using [segue destinationViewController].
    // Pass the selected object to the new view controller.
}
*/

@end
